package com.comm.tmpl.qry

class CdSaengseongGiQry {
	public static def selectActionNm(){
		String strSql = '''
			select	fn_han2eng002(:unitUpmuNm, 2) as action_class
			  from  dual
		'''
		
		return strSql
	}
	
	public static def selectEtcClassNm(){
		String strSql = '''
		select	fn_han2eng002(:upmuNm, 0) as class
		  from  dual
		'''
	
		return strSql
	}
	
	public static def selectTableList(){
		String strSql = '''
		select '0' chk,
		       owner,
		       table_name,
		       table_type,
		       comments
          from all_tab_comments
         where owner = :skima
         order by table_name
		'''
	
		return strSql
	}
	
	public static def selectColumnList(){
		String strSql = '''
		  select '0' as chk,
		         nvl(a.column_id, 0) as column_id,
		         a.owner,
                 a.table_name,
                 a.column_name,
                 b.comments,
                 nvl(a.data_length, 0) as data_length,
                 e.constraint_type,
                 a.data_default
            from all_tab_columns a,
                 all_col_comments b,
                 (
                     select c.column_name,
                            max(d.constraint_type) as constraint_type
                       from all_cons_columns c,
                            all_constraints d
                      where c.owner = d.owner (+)
                        and c.table_name = d.table_name (+)
                        and c.constraint_name = d.constraint_name (+)
                        and c.owner = :skima
                        and c.table_name = :tableNm
                        and d.constraint_type in ('P', 'F')
                      group by c.column_name
                 ) e
           where a.owner = b.owner (+)
             and a.table_name = b.TABLE_NAME (+)
             and a.column_name = b.column_name (+)
             and a.column_name = e.column_name (+)
             and a.owner = :skima
             and a.table_name = :tableNm
        order by e.constraint_type,
                 a.column_id
		'''
	
		return strSql
	}
}
